<template>
  <div id="centreRight1">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <span style="color:#5cd9e8">
          <icon name="chart-line"></icon>
        </span>
        <div class="d-flex">
          <span class="fs-xl text mx-2">课程分享排行榜</span>
        </div>
      </div>
      <div class="d-flex jc-center body-box">
        <dv-scroll-board :config="config" style="width:6.675rem;height:4.28rem" />
      </div>
    </div>
  </div>
</template>

<script>
import {getBigDataClass} from "../../http/api";

export default {
  data() {
    return {
      config: {}
    }
  },
  mounted() {
    this.getBigDataClass()
  },
  methods: {
    getBigDataClass() {
      let classList = []
      getBigDataClass().then(res => {
        for (let key in res.data.data) {
          classList.push([res.data.data[key].class_name, res.data.data[key].share_num, `<span class='${(res.data.data[key].share_num - 450)/100 > 0 ? 'colorGrass':'colorRed'}'>${(res.data.data[key].share_num - 450)/100 > 0 ? '↑':'↓'}${(res.data.data[key].share_num - 450)/100}%</span>`])
        }
        this.config = {
          header: ["课程", "分享数", "差率"],
          data: classList,
          rowNum: 5, // 表格行数
          headerHeight: 35,
          headerBGC: "#0f1325", // 表头
          oddRowBGC: "#0f1325", // 奇数行
          evenRowBGC: "#171c33", // 偶数行
          index: true,
          columnWidth: [50],
          align: ["center"]
        }
      })
    }
  }
};
</script>

<style lang="scss">
#centreRight1 {
  padding: 0.2rem;
  height: 5.125rem;
  min-width: 3.75rem;
  border-radius: 0.0625rem;
  .bg-color-black {
    height: 4.8125rem;
    border-radius: 0.125rem;
  }
  .text {
    color: #c3cbde;
  }
  .body-box {
    border-radius: 0.125rem;
    overflow: hidden;
  }
}
</style>
